﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CubSeeMusicDecode : MonoBehaviour
{
        public AudioSource audioSource;
        public float[] spectrum;

        void Start()
        {
                if (audioSource)
                {
                        spectrum = new float[512];
                }
        }

        void Update()
        {
                audioSource.GetSpectrumData(spectrum, 0, FFTWindow.BlackmanHarris);
        }

        public int GetSpectrumCount()
        {
                return spectrum.Length;
        }

        public float GetSpectrum(int n)
        {
                return spectrum[n];
        }
}
